package com.example.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

@Component
public class SiKongProperties {
    public static int coreSize;

    public static int initialDelay;

    public static int onlineMessageSendPeriod;


    public static int closeReportLivePeriod;

    public static int closeOffLineLivePeriod;

    public static String mqttServerIp;

    public static String clientId;

    public static boolean cleanSession;

    public static String username;

    public static String password;

    public static boolean automaticReconnect;



    @Value("${si-kong.mqtt.clean-session:true}")
    public void setCleanSession(boolean cleanSession) {
        SiKongProperties.cleanSession = cleanSession;
    }

    public boolean isCleanSession() {
        return SiKongProperties.cleanSession;
    }


    @Value("${si-kong.mqtt.username}")
    public void setUsername(String username) {
        SiKongProperties.username = username;
    }

    public String getUsername() {
        return SiKongProperties.username;
    }

    @Value("${si-kong.mqtt.password}")
    public void setPassword(String password) {
        SiKongProperties.password = password;
    }

    public String getPassword() {
        return SiKongProperties.password;
    }
    @Value("${si-kong.mqtt.automatic-reconnect}")
    public void setAutomaticReconnect(boolean automaticReconnect) {
        SiKongProperties.automaticReconnect = automaticReconnect;
    }

    public boolean isAutomaticReconnect() {
        return SiKongProperties.automaticReconnect;
    }


    @Value("${si-kong.mqtt.client-id}")
    public void setClientId(String clientId) {
        SiKongProperties.clientId = clientId;
    }

    public String getClientId() {
        return clientId;
    }

    @Value("${si-kong.mqtt.server-ip}")
    public void setMqttServerIp(String mqttServerIp) {
        SiKongProperties.mqttServerIp = mqttServerIp;
    }

    public String getMqttServerIp() {
        return SiKongProperties.mqttServerIp;
    }

    @Value("${si-kong.schedule.close-report-live-period}")
    public void setCloseReportLivePeriod(int closeFreeLivePeriod) {
        SiKongProperties.closeReportLivePeriod = closeFreeLivePeriod;
    }

    public int getCloseReportLivePeriod() {
        return SiKongProperties.closeReportLivePeriod;
    }

    @Value("${si-kong.schedule.close-offline-live-period}")
    public void setCloseOffLineLivePeriod(int closeOffLineLivePeriod) {
        SiKongProperties.closeOffLineLivePeriod = closeOffLineLivePeriod;
    }

    public int getCloseOffLineLivePeriod() {
        return closeOffLineLivePeriod;
    }

    @Value("${si-kong.schedule.online-message-send-period:2}")
    public void setOnlineMessageSendPeriod(int onlineMessageSendPeriod) {
        SiKongProperties.onlineMessageSendPeriod = onlineMessageSendPeriod;
    }

    public int getOnlineMessageSendPeriod() {
        return SiKongProperties.onlineMessageSendPeriod;
    }

    @Value("${si-kong.schedule.initial-delay:5}")
    public void setInitialDelay(int initialDelay) {
        SiKongProperties.initialDelay = initialDelay;
    }

    public int getInitialDelay() {
        return SiKongProperties.initialDelay;
    }

    @Value("${si-kong.schedule.core-size:2}")
    public void setCoreSize(int coreSize) {
        SiKongProperties.coreSize = coreSize;
    }
    public int getCoreSize() {
        return SiKongProperties.coreSize;
    }
}
